package com.clstu.enum_.homework;

import java.util.Scanner;

public class HomeWork07 {
    public static void main(String[] args) {
        String key="";
        boolean loop=true;
          do{
              System.out.println("请输入颜色判断显示它的比例(大写字母)(EXIT退出)：");
              key=new Scanner(System.in).next();
              switch (key){
                  case "RED":
                      Color.RED.show();
                      break;
                  case "BLUE":
                      Color.BLUE.show();
                      break;
                  case "GREEN":
                      Color.GREEN.show();
                      break;
                  case "BLACK":
                      Color.BLACK.show();
                      break;
                  case "YELLOW":
                      Color.YELLOW.show();
                      break;
                  case "EXIT":
                      System.out.println("您已经退出");
                      loop=false;
                      break;
                  default:
                      System.out.println("无效的输入");
              }
          }while(loop);
    }
}
interface Shower{
    void show();
}
enum Color implements Shower{
    RED(255,0,0),
    BLUE(0,255,0),
    GREEN(0,0,255),
    BLACK(0,0,0),
    YELLOW(255,255,0);

    private int redValue;
    private int blueValue;
    private int greenValue;

    Color(int redValue, int blueValue, int greenValue) {
        this.redValue = redValue;
        this.blueValue = blueValue;
        this.greenValue = greenValue;
    }

    @Override
    public void show() {
        System.out.println(name()+" : red： "+redValue+" blue: "+blueValue+" green: "+greenValue);
    }
}